﻿namespace com.stifel.BranchMgmt.WebParts.BranchView
{
    using System.Collections.Generic;
    using System.Text;

    using com.stifel.BranchMgmtDao;
    using com.stifel.Extensions.SharePointExtensions;

    using Microsoft.SharePoint;

    public partial class BranchViewUserControl
    {
        #region Fields

        List<uiNetwork_Data> _uiNetwork_Data_List;

        #endregion Fields

        #region Properties

        List<uiNetwork_Data> uiNetwork_Data_List
        {
            get
            {
                if ( _uiNetwork_Data_List == null )
                    _uiNetwork_Data_List = new List<uiNetwork_Data>( );
                return _uiNetwork_Data_List;
            }
            set
            {
                _uiNetwork_Data_List = value;
            }
        }

        #endregion Properties

        #region Methods

        void loadNetwork( int branchId )
        {
            StifelNetworkEquipmentDao dao = new StifelNetworkEquipmentDao( SPContext.Current.Web.Url );
            List<StifelNetworkEquipment> l = dao.GetByBranchLocation( branchId );
            foreach ( StifelNetworkEquipment o in l )
                uiNetwork_Data_List.Add( new uiNetwork_Data( o ) );
            uiNetwork_Repeater.DataSource = uiNetwork_Data_List;
            uiNetwork_Repeater.DataBind( );
        }

        #endregion Methods

        #region Nested Types

        protected class uiNetwork_Data
        {
            #region Constructors

            public uiNetwork_Data( StifelNetworkEquipment value )
            {
                Item = value.Title;
                CircuitID = value.NetworkCircuitIDs;
                Note = value.NetworkEquipment;
                IPSubnet = value.IPSubnet;
            }

            #endregion Constructors

            #region Properties

            public string CircuitID
            {
                get;
                set;
            }

            public string IPSubnet
            {
                get;
                set;
            }

            public string Item
            {
                get;
                set;
            }

            public string Note
            {
                get;
                set;
            }

            public string value
            {
                get;
                set;
            }

            #endregion Properties
        }

        #endregion Nested Types
    }
}